import xlrd,os
from common.logs import logger


file = os.path.dirname(os.path.dirname(__file__)) + '/testData/testdata.xls'

class ReadExcel():
    def __init__(self):
        self.wb = xlrd.open_workbook(file)
        self.sheet = self.wb.sheet_by_index(0)
        self.rowNum = self.sheet.nrows
    def readData(self,className,methodName):
        """
        对外方法
        :param className:
        :param methodName:
        :return:
        """
        for i in range(1,self.rowNum):
            list1 = self.sheet.row_values(i)
            classname = list1[0]
            methodname = list1[1]
            if className == classname and methodName == methodname:
                logger.info('读取到的数据为：%s' % list1[2])
                return list1[2]



if __name__ == '__main__':
    re = ReadExcel()
    print(re.readData('HomePageTest','testSearchSendKeys'))